<template>
	<view class="mainCon">
		<view class="headForm">
			<u-form :model="formData" ref="uForm" label-width="160">
				<u-form-item label="船舶名称">
					<u-input v-model="formData.bargenam" />
				</u-form-item>
				<u-form-item label="货物名称">
					<u-input v-model="formData.cargo" />
				</u-form-item> 
				<u-form-item label="审核状态" label-width="160">
					<u-input type="select"  :select-open="shShow" v-model="formData.statusLabel"
						placeholder="审核状态" @click="shShow = true"></u-input>
				</u-form-item>
				<u-form-item label="结算状态" label-width="160">
					<u-input type="select" :select-open="jsShow" v-model="formData.payStatusLabel"
						placeholder="结算状态" @click="jsShow = true"></u-input>
				</u-form-item>
			</u-form> 
			<view class="btnGroup">
				<u-button :custom-style="customStyle" type="primary" @click="insertHandle">新增</u-button>
				<u-button :custom-style="customStyle" type="primary" @click="onSearch">查询</u-button>  
			</view>
		</view>
		<view style="height: 430rpx;"></view>
		<view class="orderList">
			<view class="orderItem" v-for="(item,index) in orderList">
				<view class="orderHead">
					<view class="headcell">
						<view class="dateLabel">
							船舶名称 : {{ item.bargenam }}
						</view>
					</view>
					<view class="headcell">
						<view class="dateLabel">
							结算状态 : {{ item.payStatus }}
						</view>
					</view>
				</view>
				<view class="orderInfo">
					<view class="infoCell">
						<view class="labelName">
							申请企业 : 
						</view>
						<view class="infoCon">
							{{ item.applypeoper }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							船舶长度 : 
						</view>
						<view class="infoCon">
							{{item.shiplength }}
						</view>
					</view> 
					<view class="infoCell">
						<view class="labelName">
							船舶宽度 : 
						</view>
						<view class="infoCon">
							<!-- {{ $u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss') }} -->
							{{ item.shipwidth }}
						</view>
					</view> 
					<view class="infoCell">
						<view class="labelName">
							报港装载吨位 : 
						</view>
						<view class="infoCon">
							{{ item.ybton }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							金额 : 
						</view>
						<view class="infoCon">
							{{ item.payMoney? item.payMoney + '元' : '' }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							来港 : 
						</view>
						<view class="infoCon">
							{{ item.fport ? item.fport : ' ' }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							往港 : 
						</view>
						<view class="infoCon">
							{{ item.tport ? item.tport : ' ' }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							装卸标志 : 
						</view>
						<view class="infoCon">
							{{ item.jobWay ? item.jobWay : ' ' }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							联系电话 : 
						</view>
						<view class="infoCon">
							{{ item.tel ? item.tel : ' ' }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							审核状态 : 
						</view>
						<view class="infoCon">
							{{ item.status }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							货种 : 
						</view>
						<view class="infoCon">
							{{ item.cargo }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							货主 : 
						</view>
						<view class="infoCon">
							{{ item.customer }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							办理时间 : 
						</view>
						<view class="infoCon">
							<!-- {{ $u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss') }} -->
							{{ item.createTime ? $u.timeFormat(item.createtime, 'yyyy-mm-dd') : ' ' }}
						</view>
					</view>
					
					<view style="display: flex; justify-content: center; margin-top: 8px;">
						
						<view class="btn" @click="toMoreInfo(item)">查看</view>
						<view class="btn" @click="toThroughSW(item)">修改</view>
						<view class="btn" @click="toParse(item)">删除</view>
						<view class="btn" @click="toPay(item)">付款</view>
						<!-- <view class="btn" style="width: 200rpx;" @click="toUnPay(item)">退款申请</view> -->
					</view>
					
				</view>
			</view>
		</view>
		
		<u-modal v-model="show" :content="content" :title="title" :show-cancel-button="true"
			@confirm="throughConfirm" @cancel="show=false">
			<!-- <view style="text-align: center;">{{ content }}</view> -->
		</u-modal>
		<view style="margin-top: 200rpx;" v-if="orderList.length ===0">
			<u-empty text="暂无数据" mode="list"></u-empty>
		</view>
		<u-popup v-model="showInfo" width="100%" height="100%" :closeable="true">
			<view style="margin: 15px;">
				<view style="text-align: center;font-size: 20px;
						font-weight: 700;">
					详细信息
				</view>
				<view class="content">
					<u-form :model="form" ref="Form" label-width="210">
						<u-form-item label="船舶名称" prop="bargenam">
							<view style="display: flex; align-items: center;">
								<u-input v-model="form.bargenam" /> 
								<view class="btn" @click="onConfirm" style="display: inline-block;">查 询</view>
							</view>
						</u-form-item>
						<u-form-item label="申请企业" prop="applypeoper">
							<u-input v-model="form.applypeoper" />
						</u-form-item>
						<u-form-item label="船舶曾用名" prop="oldbargenam">
							<u-input v-model="form.oldbargenam" />
						</u-form-item>
						 <u-form-item label="货主" prop="customer">
						 	<u-input v-model="form.customer"/>
						 </u-form-item>
						 <u-form-item label="装载吨位" prop="ybton">
						 	<u-input v-model="form.ybton"/>
						 </u-form-item>
						 <u-form-item label="来港" prop="fport">
						 	<u-input v-model="form.fport"/>
						 </u-form-item>
						 <u-form-item label="往港" prop="tport">
						 	<u-input v-model="form.tport" />
						 </u-form-item>
						 <u-form-item label="是否开票" prop="iskp">
						 	<u-input v-model="form.iskp" type="select" :select-open="kpShow" @click="kpShow = true"/>
						 </u-form-item>
						 <u-form-item label="船舶长度" prop="shiplength">
						 	<u-input v-model="form.shiplength"/>
						 </u-form-item>
						 <u-form-item label="船舶宽度" prop="shipwidth">
						 	<u-input v-model="form.shipwidth"/>
						 </u-form-item>
						 <u-form-item label="核定干舷" prop="freeboard">
						 	<u-input v-model="form.freeboard" />
						 </u-form-item>
						 <u-form-item label="联系电话" prop="tel">
						 	<u-input v-model="form.tel" />
						 </u-form-item>
						 <u-form-item label="满载吃水" prop="shipdraft">
						 	<u-input v-model="form.shipdraft" />
						 </u-form-item>
						 <u-form-item label="船籍港" prop="shipregistport">
						 	<u-input v-model="form.shipregistport" />
						 </u-form-item>
						 <u-form-item label="船舶总吨" prop="shipnet">
						 	<u-input v-model="form.shipnet" />
						 </u-form-item>
						 <u-form-item label="参考载货量" prop="loadtonnage">
						 	<u-input v-model="form.loadtonnage" />
						 </u-form-item>
						 <u-form-item label="所有人" prop="shipoper">
						 	<u-input v-model="form.shipoper" />
						 </u-form-item>
						 <u-form-item label="经营人" prop="shipcorp">
						 	<u-input v-model="form.shipcorp" />
						 </u-form-item>
						 <u-form-item label="实际控制人" prop="actualpeoper">
						 	<u-input v-model="form.actualpeoper" />
						 </u-form-item>
						 <u-form-item label="MMSI码" prop="mmsicod">
						 	<u-input v-model="form.mmsicod" />
						 </u-form-item>
						 <u-form-item label="最大高度" prop="maximumheight">
						 	<u-input v-model="form.maximumheight" />
						 </u-form-item>
						 
						 <u-form-item label="船舶建造日期:" prop="shipbuilddate">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin1 = true">{{ form.shipbuilddate }}</u-button>
						 </u-form-item>
						 
						 <u-form-item label="船籍证有效期:" prop="cjzsyxq">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin2 = true">{{ form.cjzsyxq }}</u-button>
						 </u-form-item>
						 
						 <u-form-item label="适航证有效期:" prop="shzsyxq">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin3 = true">{{ form.shzsyxq }}</u-button>
						 </u-form-item>
						 
				<!-- 		 <u-form-item label="电台执照有效期:" prop="diantaiDate">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin4 = true">{{ form.diantaiDate }}</u-button>
						 </u-form-item> -->
						 <u-form-item label="装卸标识" prop="jobWay">
						 	<u-input v-model="form.jobWay" type="select" :select-open="jobWayShow" @click="jobWayShow = true"/>
						 </u-form-item>
						 
						 <u-form-item label="内外贸" prop="tradeType">
						 	<u-input v-model="form.tradeType" type="select" :select-open="tradeTypeShow" @click="tradeTypeShow = true"/>
						 </u-form-item>
						 
						 <u-form-item label="货种" prop="cargoTypeLabel">
						 	<u-input v-model="form.cargoTypeLabel" />
						 </u-form-item>
						 <u-form-item label="前吃水" prop="beforeDraft">
						 	<u-input v-model="form.beforeDraft" />
						 </u-form-item>
						 <u-form-item label="后吃水" prop="afterDraft">
						 	<u-input v-model="form.afterDraft" />
						 </u-form-item>
						 
						 <!-- <u-form-item label="驳回原因">
						 	<view>{{ form.unPayReason ? form.unPayReason : '' }}</view>
						 </u-form-item> -->
						 
						 <u-form-item label="图片上传"  v-if="!insertshow">
							 <u-upload ref="uUpload" :action="action" :size-type="['compressed']"  name="file" :auto-upload="true" 
								@on-success="handleSuccess" @on-remove="handleRemove" :max-count="maxCount" >
							 </u-upload>
						 </u-form-item>
						 <u-form-item  label="已上传的图片" v-if="upPicShow">
							<view v-for="(item, index) in fileDate2" :key="item.id" class="pic">
								<view id="finsihPic">
									<view style="text-align: center;">{{ item.name }}</view>
									<u-image @click="previewImage(item, index, 2)" :lazy-load="true" width="100px" height="100px" :src="item.url"></u-image>
									<view class="btn" style="background-color: #ff4949;" @click="deletePic(item)">删除</view>
								</view>
							</view>
						 </u-form-item>
					</u-form>
					<u-divider v-if="insertshow" half-width="250" border-color="#6d6d6d">驳船附件</u-divider>
					<view class="picContent"  v-if="insertshow">
						<view v-for="(item, index) in fileDate1" :key="item.id" class="pic">
							<view style="text-align: center;">{{ item.name }}</view>
							<u-image @click="previewImage(item, index, 1)" :lazy-load="true" width="100px" height="100px" :src="item.url"></u-image>
						</view>
					</view>
					

					<u-divider v-if="insertshow" half-width="250" border-color="#6d6d6d">申请附件</u-divider>
					<view class="picContent"  v-if="insertshow">
						<view v-for="item in fileDate2" :key="item.id" class="pic">
							<view style="text-align: center;">{{ item.name }}</view>
							<u-image @click="previewImage(item, index, 2)" :lazy-load="true" width="100px" height="100px" :src="item.url"></u-image>
						</view>
					</view>
					<view v-if="!insertshow" style="display: flex; justify-content: center;height:100rpx; margin-top: 8px;">
						<view class="btn" @click="submit()">确 定</view>
						<view class="btn" @click="showInfo = false">取 消</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-modal v-model="showDel" content="是否要删除" title="确定要删除吗" :show-cancel-button="true"
			@confirm="throughConfirmDel" @cancel="showDel=false">
		</u-modal>
		<u-modal v-model="payShow" :content="content" title="确定要付款吗" :show-cancel-button="true"
			@confirm="throughConfirmPay" @cancel="payCancelConfirm">
		</u-modal>
		<u-modal v-model="refundShow" content="真的要退款吗" title="确定要退款吗" :show-cancel-button="true"
			@confirm="throughConfirmrefund" @cancel="refundShow = false">
		</u-modal>
		<u-picker v-model="showBegin1" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm1"></u-picker>
		<u-picker v-model="showBegin2" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm2"></u-picker>
		<u-picker v-model="showBegin3" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm3"></u-picker>
		<u-picker v-model="showBegin4" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm4"></u-picker>
		<u-top-tips ref="uTips" z-index="999999"></u-top-tips>
		<u-select mode="single-column" :list="shShowList" v-model="shShow" @confirm="shShowConfirm"
			value-name="value" label-name="name"></u-select>
		<u-select mode="single-column" :list="jsShowList" v-model="jsShow" @confirm="jsShowConfirm"
			value-name="value" label-name="name"></u-select>
		
		<!-- 是否开票 -->
		<u-select mode="single-column" :list="iskpOptions" v-model="kpShow" @confirm="kpShowConfirm"
			value-name="name" label-name="name">
		</u-select>
		<!-- 装卸标志 -->
		<u-select mode="single-column" :list="jobWayList" v-model="jobWayShow" @confirm="jobWayConfirm"
			value-name="name" label-name="name">
		</u-select>
		<!-- 内外贸 -->
		<u-select mode="single-column" :list="tradeTypeList" v-model="tradeTypeShow" @confirm="tradeTypeShowConfirm"
			value-name="name" label-name="name">
		</u-select>
		
		<u-popup v-model="payInfo" mode="center" width="80%" height="55%" :mask-close-able="false">
			<view style="margin:15px 0;text-align: center;font-size: 18px;">扫描二维码付款</view>
			<view id="qrcode" style="display: flex; justify-content: center; margin-bottom:20px;">
				<!-- @click="qrtextClick" -->
				<!-- <uv-qrcode  ref="qrcode" size="300px" :value="qrtext"  @longpress="handleLongPress"></uv-qrcode> -->
			</view>
			<view style="margin:8px 0;text-align: center;font-size: 18px;">待支付金额{{ payAmount }}元</view>
			<view style="display: flex; justify-content: center;height:100rpx; margin-top: 8px;">
				<view class="btn" @click="unPaySubmit">取 消</view>
				<view class="btn" @click="paySubmit">已完成支付</view>
			</view>
		</u-popup>
		
		<u-modal v-model="picNameShow" content="输入图片名称" title="输入图片名称" :show-cancel-button="false"
			@confirm="picNameConfirmDel" >
			<u-form  label-width="100px">
				<u-form-item label="图片名称:" >
					<u-input v-model="picName" placeholder="请输入图片名称"/>
				</u-form-item>
			</u-form>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				picName: '',		// 图片名称
				picNameShow: false,	// 图片名称控制器
				refundShow: false,	// 是否退款控制器
				refundObj: {},		// 是否退款对象
				payInfo: false,		// 付款二维码控制器
				shipObj: {},		// 驳船信息
				insertshow: false,	// 控制驳船附件的显示
				upPicShow: false,	// 控制已上传图片显示
				tabList: ['商务核销','待生产部审核', '已完成', '已废除'],
				current: 0, 
				orderList: [],
				tel: '',
				flag: false,
				level: '',
				department: '',
				portname: '',
				show: false,
				showInfo: false,
				title: '',
				content: '',
				obj: {},
				carItem: {},
				reason: '',
				fileDate1: [],
				uploadList: [],			// 上传的图片
				pic1: [],				// 预览的图片
				pic2: [],
				fileDate2: [],	
				payShow: false,			// 确定要付款弹出框
				jsShow: false,
				shShow: false,
				showBegin1: false,
				showBegin2: false,
				showBegin3: false,
				showBegin4: false,
				defaultTime: '',
				stateShow: '', 		// 详细界面审核状态
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				infoId: '',	
				formData: {},
				form: {
					mmsicod: ''
				},		// 查看详细
				showReason: false,		// 审核拒绝的控制器
				reason: '',				// 审核拒绝的理由
				idShip: '',				// 船的id
				showDel: false,			// 删除提示框
				delObj: {},
				manageShow: false,		// 审核和反审核权限
				action: 'https://api.zlkj-port.com/ZLBG/common/upload1',				// 图片上传地址
				shShowList: [
				    { name: '所有', value: '' },
				    { name: '待商务部审核', value: 1 },
				    { name: '待生产部核销', value: 2 },
				    { name: '已完成', value: 3 },
				    { name: '已废除', value: -1 }    
				],
				jsShowList: [
					{ name: '所有', value: '' },
				    { name: '待结算', value: 2 },
				    { name: '结算完成', value: 1 },
				    { name: '退款中', value: 3 },    
				    { name: '退款完成', value: 4 },  
				    { name: '驳回', value: 5 },
				],
				// 是否开票
				iskpOptions: [
					{ name: '是' },
					{ name: '否' }
				],
				// 装卸标志
				jobWayList: [
				    { name: '装' },
				    { name: '卸' }
				],
				// 内外贸
				tradeTypeList: [
					{ name: '内贸' },
				    { name: '外贸' }
				],
				customStyle: {
					height: '60rpx',
				}, 
				customTimeStyle: {
					height: '60rpx',
				},
				kpShow: false,
				jobWayShow: false,
				tradeTypeShow: false,
				maxCount: 1,
				rules: {
					bargenam: [ { required: true, message: '船舶名称不能为空' } ],
					applypeoper: [ { required: true, message: '申请企业不能为空' } ],
					customer: [ { required: true, message: '货主不能为空' } ],
					ybton: [ { required: true, message: '装载吨位不能为空,只能输入数字', type: 'float' } ],
					fport: [ { required: true, message: '往港不能为空' } ],
					tport: [ { required: true, message: '来港不能为空' } ],
					iskp: [ { required: true, message: '是否开票不能为空' } ],
					shiplength: [ { required: true, message: '船舶长度不能为空,只能输入数字', type: 'float' } ],
					shipwidth: [ { required: true, message: '船舶宽度不能为空,只能输入数字', type: 'float' } ],
					freeboard: [ { required: true, message: '核定干舷不能为空', type: 'float' } ],
					tel: [ { required: true, message: '联系电话不能为空,只能输入数字', type: 'float' } ],
					shipdraft: [ { required: true, message: '满载吃水不能为空,只能输入数字', type: 'float' } ],
					shipregistport: [ { required: true, message: '船籍港不能为空' } ],
					shipnet: [ { required: true, message: '船舶总吨不能为空,只能输入数字', type: 'float' } ],
					shipoper: [ { required: true, message: '所有人不能为空' } ],
					shipcorp: [ { required: true, message: '经营人不能为空' } ],
					mmsicod: [ { required: true, message: 'MMSI码不能为空,只能输入数字', type: 'float' } ],
					maximumheight: [ { required: true, message: '最大高度不能为空,只能输入数字', type: 'float' } ],
					shipbuilddate: [ { required: true, message: '船舶建造日期不能为空' } ],
					cjzsyxq: [ { required: true, message: '船籍证有效期不能为空' } ],
					shzsyxq: [ { required: true, message: '适航证有效期不能为空' } ],
					jobWay: [ { required: true, message: '装卸标识不能为空' } ],
					tradeType: [ { required: true, message: '内外贸不能为空' } ],
					cargoTypeLabel: [ { required: true, message: '货种不能为空' } ],
				},
				concat: '',		// 对应pc端的用户nickname
				userPcId: '',	// 对应pc端的用户id
				userPcName: '',	// 对应pc端用户name
				planAB: '',		// 吨位钱AB计划
				brgId: '',
				payObj: {},		// 付款obj
				payAmount: '',	// 二维码付款金额
				orderNo: '',	// 创建的订单号
				qrtext: '',
				merchant_no: '',
				header: {
					'Content-Type': 'multipart/form-data; charset=utf-8'
				}
			};
		},
		onLoad(options) {
			//uni.getStorageSync("userInfo").mobile
			this.tel = uni.getStorageSync("userInfo").mobile
			this.power()
		},
		onReady() {
			this.$refs.Form.setRules(this.rules)
		},
		methods: {
			power() {
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/concat/getInfo',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						telNumber: this.tel,
					},
					success: (res) => {
						this.userPcId = res.data.userId
						this.concat = res.data.remark
						this.userPcName = res.data.remarkName
						// 获取pc端用户的信息
						uni.request({
							// url: 'http://175.27.188.46:9051/prod-api/system/user/list',
							url: 'https://api.zlkj-port.com/ZLBG/system/user/list',
							method: 'get',
							data: {
								userName: this.userPcName
							},
							success: (res) => {
								this.money = res.data.rows[0].money
								this.planAB = res.data.rows[0].planAB
								console.log(res)
								this.getState1()
							}
						})
					}
				})
			},
			shShowConfirm(e) {
				this.formData.statusLabel = e[0].label
				this.formData.status = e[0].value
			},
			jsShowConfirm(e) {
				this.formData.payStatusLabel = e[0].label
				this.formData.payStatus = e[0].value
			},
			kpShowConfirm(e) {
				console.log(e)
				this.form.iskp = e[0].value 
			},
			jobWayConfirm(e) {
				this.form.jobWay = e[0].value
			},
			tradeTypeShowConfirm(e) {
				this.form.tradeType = e[0].value
			},
			// 时间确认按钮
			confirm1(val) {
				this.form.shipbuilddate = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.shipbuilddate)
			},
			confirm2(val) {
				this.form.cjzsyxq = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.cjzsyxq)
			},
			confirm3(val) {
				this.form.shzsyxq = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.shzsyxq)
			},
			confirm4(val) {
				this.form.diantaiDate = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.diantaiDate)
			},
			onSearch(){
				this.getState1()
			},
			previewImage(e, index, num) {
				uni.previewImage({
					// 需要预览的图片链接列表。若无需预览，可以注释urls
					urls: num == 1 ? this.pic1 : this.pic2,
					// 为当前显示图片的链接/索引值
					current: index,
					// 图片指示器样式	
					indicator: 'default',
					// 是否可循环预览
					loop: false,
					success: res => {
						console.log('previewImage res', res)
					},
					fail: err => {
						console.log('previewImage err', err)
					}
				})
			},
			handleLongPress() {
				// console.log(this.$refs.qrcode)
				// uni.previewImage({
				//     urls: [this.$refs.qrcode.toDataURL()], // 将二维码转为图片DataURL进行预览
				// })
				// 获取canvas节点
				uni.createSelectorQuery().select('#qrcode').node().exec(function(res) {
				  var canvasNode = res[0].node
				
				  // 将canvas转换成Base64
				  var base64Data = canvasNode.toDataURL('image/png')
				  console.log('Base64:', base64Data)
				})
			},
			// 上传成功回调函数
			handleSuccess(response) {
				console.log(response)
				this.uploadList.push({
					name: response.originalFilename,
					url: response.url
				})
				this.picNameShow = true
				this.maxCount++
				this.$forceUpdate()
			},
			// 图片名称确定
			picNameConfirmDel() {
				console.log(this.maxCount-2)
				console.log(this.uploadList[this.maxCount-2])
				if(this.picName) {
					this.uploadList[this.maxCount-2].name = this.picName
					this.picNameShow = false
					this.picName = ''		// 清空图片名称
					console.log('111:', this.uploadList)
				} else {
					this.$refs.uTips.show({
						title: '请输入图片名称，图片名称不能为空！',
						type: 'warning',
						duration: '2300'
					})
					this.picNameShow = true
				}
			},
			// 移除图片的时候触发
			handleRemove(index, lists, name) {
				console.log('被移除:', index, lists, name)
				this.uploadList.splice(index, 1);
				console.log(this.uploadList)
			},
			// 船舶查询
			onConfirm() {
				if(this.form.bargenam) {
					uni.showLoading({
						title: '加载中...'
					})
					uni.request({
						url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/selectListForApplay',
						method: 'post',
						header: {
							'Content-Type': 'application/json;charset=UTF-8'
						},
						data: {
							pageNum: 1,
							pageSize: 100,
							bargenam: this.form.bargenam,
						},
						success: (res) => {
							console.log(res.data.rows)
							this.shipObj = res.data.rows[0]
							uni.hideLoading()
							if(res.data.rows.length == 0) {
								this.$refs.uTips.show({
									title: '该船信息未审核或者已经驳回，请联系管理员审核',
									type: 'warning',
									duration: '2300'
								})
							} else {
								console.log(this.shipObj)
								// 搜索到船则就赋值
								uni.request({
									// 是否存在且已完成
									url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/listFinished',
									method: 'get',
									data: {
										bargenam: this.shipObj.bargenam
									},
									success: (res) =>{
										let valList = []
										// || val.payStatus == 3 || val.payStatus == 4
										valList = res.data.rows.filter(val => {
											return val.status == 1 || val.status == 2 
										})
										console.log(11111,valList)
										if(valList.length > 0) {
											if (valList[0].status == 1) {
												this.$refs.uTips.show({
													title: '该船上一次申报信息，商务部未审核！请联系码头管理员处理！',
													type: 'warning',
													duration: '2300'
												})      
											}
											if (valList[0].status == 2) {
											    this.$refs.uTips.show({
											    	title: '该船上一次申报信息，生产部未审核！请联系码头管理员处理！',
											    	type: 'warning',
											    	duration: '2300'
											    })             
											}
											return
										} else {
											if(!this.shipObj.bgId) {
												this.$refs.uTips.show({
													title: '该船同步信息未完成，请联系管理员！',
													type: 'warning',
													duration: '2300'
												})   
												return
											}
											uni.request({
												url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/getbargefilesdata',
												method: 'post',
												header: {
													'Content-Type': 'application/json;charset=UTF-8'
												},
												data: {
													bgBargeid: this.shipObj.id,
													typ: '驳船'
												},
												success: (res) => {
													console.log(res.data)
													if (res.data.length < 0 || !this.shipObj.shzsyxq || !this.shipObj.cjzsyxq || !this.shipObj.shipbuilddate) {
													    this.$refs.uTips.show({
													    	title: '该船的适航证有效期、船籍证有效期、' +
																'船舶建造日期、以及附件图片不能有一个为空！请去驳船档案补全资料！',
													    	type: 'warning',
													    	duration: '2300'
													    })
													}
												}
											})
										}
										this.brgId = this.shipObj.id
										this.form.bargeid = this.shipObj.bgId // 中林船的id
										          
										this.form.oldbargenam = this.shipObj.oldbargenam
										this.form.shipsbcod = this.shipObj.shipsbcod
										this.form.shiplength = this.shipObj.shiplength
										this.form.shipwidth = this.shipObj.shipwidth
										this.form.freeboard = this.shipObj.freeboard
										this.form.shipregistport = this.shipObj.shipregistport
										this.form.shipnet = this.shipObj.shipnet
										this.form.shipdraft = this.shipObj.shipdraft
										this.form.loadtonnage = this.shipObj.loadtonnage
										this.form.shipoper = this.shipObj.shipoper
										this.form.shipcorp = this.shipObj.shipcorp
										this.form.shzsyxq = this.shipObj.shzsyxq
										this.form.mmsicod = this.shipObj.mmsicod
										this.form.maximumheight = this.shipObj.maximumheight
										this.form.shipbuilddate = this.shipObj.shipbuilddate
										this.form.cjzsyxq = this.shipObj.cjzsyxq
										this.$refs.uTips.show({
											title: '查询成功！',
											type: 'success',
											duration: '2300'
										})
										this.$forceUpdate()	// 强制视图更新
									}
								})
							}
						},
						error: () => {
							uni.hideLoading()
						}
						
					})
				}
			},
			// 新增
			insertHandle() {
				// 设定默认值
				this.form = {}
				this.form.applypeoper = this.concat
				this.form.actualpeoper = '---'
				this.form.beforeDraft = 0
				this.form.afterDraft = 0
				this.form.iskp = '否'
				this.form.tradeType = '内贸'
				// 页面权限控制
				this.upPicShow = false
				this.stateShow = ''
				this.insertshow = false
				this.$nextTick(() => {
					// 清空图片
					this.$refs.uUpload.clear()
					this.uploadList = []
				})
				this.showInfo = true
			},
			// 修改
			toThroughSW(row) {
				console.log(row)
				if (row.payStatus == '结算完成') {
					this.$refs.uTips.show({
						title: '该申请单已支付，无法进行修改操作！',
						type: 'warning',
						duration: '2300'
					})
				    return
				}
				
				this.$nextTick(() => {
					// 清空图片
					this.$refs.uUpload.clear()
					this.uploadList = []
				})
				this.toMoreInfo(row)
				this.upPicShow = true
				this.insertshow = false
			},
			// 修改，新增提交
			submit() {
				this.$refs.Form.validate(valid => {
					if(valid) {
						this.form.cargo = this.form.cargoTypeLabel
						this.form.cargoNameLabel = this.form.cargoTypeLabel
						this.form.cargoName = this.form.cargoTypeLabel
						this.form.planWeight = this.form.ybton  // 作业模式
						this.form.workway = this.form.jobWay  // 装卸标识
						this.form.bgBargeapplydetailList = []
						this.form.bgUploadfiles = this.uploadList
						this.form.username = this.concat	// 新增报港的用户
						if (this.form.bgUploadfiles.length > 0) {
						    this.form.bgUploadfiles = this.form.bgUploadfiles.map(item => {
						    return { ...item, ...{ typ: '申请' } }
						    })
							console.log(this.form.bgUploadfiles)
						}
						if(this.form.id != null) {
							// 修改
							uni.showLoading({
								title: '加载中...'
							})
							uni.request({
								url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/update',
								method: 'post',
								header: {
									'Content-Type': 'application/json;charset=UTF-8'
								},
								data: this.form,
								success: (res) => {
									this.showInfo = false
									this.getState1()
									uni.hideLoading()
									this.$refs.uTips.show({
										title: '修改成功！',
										type: 'success',
										duration: '2300'
									})
								}
							})
							
						} else {
							// 新增
							// 图片
							// 判断是否重复
							this.form.shipId = this.brgId
							uni.showLoading({
								title: '加载中...'
							})
							uni.request({
								url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply',
								method: 'post',
								header: {
									'Content-Type': 'application/json;charset=UTF-8'
								},
								data: this.form,
								success: (res) => {
									uni.hideLoading()
									this.getState1()
									this.showInfo = false
									this.$refs.uTips.show({
										title: '新增成功！',
										type: 'success',
										duration: '2300'
									})
								}
							})
						}
					}
				})
			},
			// 删除图片
			deletePic(item) {
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/deletebguploadfilesbyid',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						id: item.id
					},
					success: (res) => {
						uni.request({
							url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/getbargefilesdata',
							method: 'post',
							header: {
								'Content-Type': 'application/json;charset=UTF-8'
							},
							data: {
								bgBargeid: this.infoId,
								typ: '申请'
							},
							success: (res) => {
								this.$refs.uTips.show({
									title: '删除成功！',
									type: 'success',
									duration: '2300'
								})
								this.pic2 = []
								this.fileDate2 = JSON.parse(JSON.stringify(res.data))
								this.fileDate2.forEach(item => {
									this.pic2.push(item.url)
								})
							}
						})
					}
				})
			},
			// 付款
			toPay(row) {
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/' + row.id,
					method: 'get',
					success: (res) => {
						row = res.data.data
						this.payObj = row
						this.qrtext = ''
						console.log(row)
						if (row.payStatus == 1) {
							this.$refs.uTips.show({
								title: '此申请单已经付款过了，无需再次支付！',
								type: 'warning',
								duration: '2300'
							})
							this.getState1()
						    return
						}
						
						// 余额足够支付的情况下
						if(row.payMoney <= this.money) {
							this.content = '您的账户余额为' + this.money + '元是否需要余额支付'
							this.payShow = true
						} else {
							// 余额不足
							this.payCancelConfirm()
						}
					}
				})
				
			},
			// 余额支付
			throughConfirmPay() {
				console.log(111)
				uni.showLoading({
					title: '加载中...'
				})
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/system/user/edit',
					method: 'put',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						money: Number(this.money) - Number(this.payObj.payMoney),
						userId: this.userPcId
					},
					success: (res) => {
						uni.request({
							url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/modifyPayStatus',
							method: 'post',
							header: {
								'Content-Type': 'application/json;charset=UTF-8'
							},
							data: {
								id: this.payObj.id,
								bargeapplyId: this.payObj.id,
								money: this.payObj.payMoney,
								reviewer: this.concat
							},
							success: (res) => {
								this.$refs.uTips.show({
									title: '付款成功！',
									type: 'success',
									duration: '2300'
								})
								this.power()
								this.$forceUpdate()
								uni.hideLoading()
								this.payShow = false			// 关闭弹出框
							},
							error: (res) => {
								uni.hideLoading()
							}
						})
					},
					error: (error) => {
						uni.hideLoading()
					}
					
				})
			},
			
			// 退款申请
			toUnPay(row) {
				console.log(row)
				// if (row.payStatus == 3 || row.payStatus == 4) {
				if (row.payStatus == '退款中' || row.payStatus == '退款完成') { 
					this.$refs.uTips.show({
						title: '当前报港单正在退款中或者已经退款，无法再次退款！',
						type: 'warning',
						duration: '2300'
					})
				    return
				}
				
				// if (row.payStatus != 1) {
				if (row.payStatus != '结算完成') {
					this.$refs.uTips.show({
						title: '未付款不能退款！',
						type: 'warning',
						duration: '2300'
					})
				    return
				}
				// if(row.status == 3) {
				if(row.status == '已审核') {
					this.$refs.uTips.show({
						title: '当前报港申请单审核已完成无法退款。',
						type: 'warning',
						duration: '2300'
					})
				} else {
					this.refundObj = row
					this.refundShow = true	
				}
			},
			// 确定退款
			throughConfirmrefund() {
				console.log(this.refundObj)
				// 退款申请
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/unPayApplay',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						id: this.refundObj.id
					},
					success: (res) => {
						this.$refs.uTips.show({
							title: '退款申请成功！',
							type: 'success',
							duration: '2300'
						})
						this.getState1()
						this.$forceUpdate()
					}
				})
			},
			// 取消余额支付
			payCancelConfirm() {
				this.payShow = false	
				console.log('我取消了余额支付')
				if (this.planAB == 1) {
				    if (this.payObj.ybton > 0 && this.payObj.ybton <= 1000) { 
						this.payAmount = 5
				    } else if (this.payObj.ybton > 1000 && this.payObj.ybton <= 3000) {
				        this.payAmount =  10
				    } else if (this.payObj.ybton > 3000 && this.payObj.ybton <= 5000) {
				        this.payAmount =  20
				    }
				    else if (this.payObj.ybton > 5000) {
				        this.payAmount =  30
				    }
				} 
				else if (this.planAB == 2) {
				    if (this.payObj.ybton > 0 && this.payObj.ybton <= 3000) { 
				        this.payAmount = 10
				    } else if (this.payObj.ybton > 3000) {
				        this.payAmount =  20
				    } 
				}
				// this.handleConfirm()
				this.newHandleConfirm()
			},
			// 新的支付
			newHandleConfirm() {
				uni.request({
					url: 'https://pay.zlkj-port.com/paysys/online_pay/zlkj/pay/preorder',
						data: {
							"req_time":Date.now(),
							"version":"3.0",
							"out_org_code":"OP00000397",
							"req_data":{
								// 822305048160EYT   8223050421500NM
							   "merchant_no": "8223050421500NM",
							    "term_no":"J4039690",
							    "out_trade_no":this.uuid(),
							    "account_type":"WECHAT",
							    "trans_type":71,
							    "total_amount":this.payAmount*100,
							    "location_info":{
							        "request_ip":"119.45.9.131"
							    },
							    "notify_url":"",
							    "acc_busi_fields":{
							        "sub_appid":"wx8c96ae29e572f561",
							        "user_id":uni.getStorageSync("userInfo").openid,
							        "attach":""
							    }
							}
						}, 
						headers: {
						 'Content-Type': 'application/json'
					   }, 
						method: "POST", 
						success: (res) => {
							console.log(res);
							if(res.data.msg=="验签成功"){
								let resdata=  JSON.parse(res.data.source.substr(res.data.source.indexOf("{"),res.data.source.length))
								console.log(resdata.resp_data.acc_resp_fields.time_stamp); 
								console.log(resdata.resp_data.acc_resp_fields.nonce_str); 
								console.log(resdata.resp_data.acc_resp_fields.package); 
								wx.requestPayment
								(
									{
										"timeStamp": resdata.resp_data.acc_resp_fields.time_stamp,
										"nonceStr": resdata.resp_data.acc_resp_fields.nonce_str,
										"package": resdata.resp_data.acc_resp_fields.package,
										"signType": "RSA",
										"paySign":resdata.resp_data.acc_resp_fields.pay_sign,
										"success": (res) => {
											console.log(res); 
											// uni.showToast({
											// 	title: '支付成功'
											// }) 
											// 处理支付成功的事务
											uni.request({
												url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/modifyPayStatus',
												method: 'post',
												header: {
													'Content-Type': 'application/json;charset=UTF-8'
												},
												data: {
													id: this.payObj.id,
													bargeapplyId: this.payObj.id,
													money: this.payObj.payMoney,
													reviewer: this.concat,
													orderNo: this.orderNo
												},
												success: (res) => {
													this.$refs.uTips.show({
														title: '支付成功',
														type: 'success',
														duration: '2300'
													})
													this.getState1()
													this.$forceUpdate()
												}
											})
										},
										"fail":function(res){
											uni.showToast({
												title: "支付失败2",
												icon: 'none'
											}) 
										},
										"complete":function(res){}
									}
								) 
							}else{
								uni.showToast({
									title: res.data.msg,
									icon: 'none'
								}) 
							} 
						},
						fail() {
							uni.showToast({
								title: "支付失败1",
								icon: 'none'
							}) 
						}
				})   
			}, 
			// 已完成支付
			paySubmit() {
				// 判断当前订单是否支付完成-完成修改状态
				const sj = this.getAfterDate(1, "normal")
				let data = JSON.stringify({
				        "req_time": sj,
				        "version": "3.0",
				        "out_org_code": "OP00000397",
				        "req_data": {
				        "merchant_no": this.merchant_no ,
				        "out_order_no": this.out_order_no
				    }  
				})
				uni.request({
					url: 'http://1.13.17.168:8080/online_pay/zlkj/pay/queryOrder',
					method: 'post',
					headers: {
					    'Content-Type': 'application/json'
					},
					data: data,
					success: (res) => {
						if(res.data.resp_data.order_status=='0') {
							this.$refs.uTips.show({
								title: '订单待支付',
								type: 'warning',
								duration: '2300'
							})
						}
						if(res.data.resp_data.order_status=='1') {
							this.$refs.uTips.show({
								title: '订单待支付中',
								type: 'warning',
								duration: '2300'
							})
						}
						if(res.data.resp_data.order_status=='2') {
							// 更改支付状态 插入订单号 3.插入扣款表
							uni.request({
								url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/modifyPayStatus',
								method: 'post',
								header: {
									'Content-Type': 'application/json;charset=UTF-8'
								},
								data: {
									id: this.payObj.id,
									bargeapplyId: this.payObj.id,
									money: this.payObj.payMoney,
									reviewer: this.concat,
									orderNo: this.orderNo
								},
								success: (res) => {
									this.getState1()
									this.payInfo = false
									this.$refs.uTips.show({
										title: '支付成功',
										type: 'success',
										duration: '2300'
									})
								}
							})
						}
						if(res.data.resp_data.order_status=='3') {
							this.$refs.uTips.show({
								title: '支付失败',
								type: 'warning',
								duration: '2300'
							})
						}
						if(res.data.resp_data.order_status=='4') {
							this.$refs.uTips.show({
								title: '订单已过期',
								type: 'warning',
								duration: '2300'
							})
						}
						if(res.data.resp_data.order_status=='5') {
							this.$refs.uTips.show({
								title: '订单已取消',
								type: 'warning',
								duration: '2300'
							})
						}
					}
				})
			},
			// 关闭支付二维码弹出层
			unPaySubmit() {
				// 判断有没有支付，支付了插入表数据
				if (this.out_order_no != '') {
					this.QRCloseQRCommit()
				}
				this.payInfo = false
				this.merchant_no = ''    //商户号
				this.getState1()
			},
			QRCloseQRCommit() {
				const sj = this.getAfterDate(1, "normal")
				let data = JSON.stringify({
				        "req_time": sj,
				        "version": "3.0",
				        "out_org_code": "OP00000397",
				        "req_data": {
				        "merchant_no": this.merchant_no ,
				        "out_order_no": this.out_order_no
				    }  
				})
				uni.request({
					url: 'http://1.13.17.168:8080/online_pay/zlkj/pay/queryOrder',
					method: 'post',
					headers: {
					    'Content-Type': 'application/json'
					},
					data: data,
					success: (res) => {
						if(res.data.resp_data.order_status=='2') {
							// 更改支付状态 插入订单号 3.插入扣款表
							uni.request({
								url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/modifyPayStatus',
								method: 'post',
								header: {
									'Content-Type': 'application/json;charset=UTF-8'
								},
								data: {
									id: this.payObj.id,
									bargeapplyId: this.payObj.id,
									money: this.payObj.payMoney,
									reviewer: this.concat,
									orderNo: this.orderNo
								},
								success: (res) => {
									this.$refs.uTips.show({
										title: '支付成功',
										type: 'success',
										duration: '2300'
									})
								}
							})
						}
					}
				})
			},
			// 创建订单信息
			handleConfirm() {
				// 返回二维码信息
				this.createOrder()
				this.payInfo = true	
				this.$nextTick(() => {
					// 生成二维码
					this.qrcodeMake(this.qrtext)
				})
			},
			// 创建订单，返回二维码信息
			createOrder() {
				this.orderNo = this.uuid()
				let dqTim = this.getAfterDate(3)
				let data = JSON.stringify({
				    "req_data": {
						"out_order_no": this.orderNo,
						"merchant_no": "822305048160EYT",
						"vpos_id": "784100963409014784",
						"total_amount": this.payAmount, // 支付金额
						"order_efficient_time": dqTim,
						"notify_url": "http://run.mocky.io/v3/b02c9448-20a2-4ff6-a678-38ecab30161d",
						"support_cancel": "0",
						"support_refund": "1",
						"support_repeat_pay": "1",
						"order_info": "苏中国际平台支付",
						"extend_info": "苏中国际平台支付",
						"callback_url": ""
				    },
				    "version": "3.0",
				    "req_time": "20220714160009"
				})
				uni.request({
					url: 'http://1.13.17.168:8080/online_pay/zlkj/pay/creatOrder',
					method: 'post',
					headers: {
					    'Content-Type': 'application/json; charset=utf-8'
					},
					data: data,
					success: (res) => {
						console.log(res)
						this.qrtext = res.data?.resp_data?.counter_url
						this.out_order_no = res?.data.resp_data?.out_order_no
						this.merchant_no = res?.data.resp_data?.merchant_no
					}
				})
			},
			// 生成二维码
			qrcodeMake(url) {
				// new QRCode(this.$refs.qrcode, {
				//     correctLevel : 3,
				//     width: 300, // 二维码宽度，单位像素
				//     height: 300, // 二维码高度，单位像素
				//     text: url // 生成二维码的链接
				// })
			},
			// 二维码点击
			qrtextClick() {
				if(this.qrtext) {
					uni.previewImage({
						urls: [this.qrtext],
						current: 1,
						indicator: 'default',
						loop: false,
						success: res => {
							console.log('previewImage res', res)
						},
						fail: err => {
							console.log('previewImage err', err)
						}
					})
				}	
			},
			// 创建随机订单号
			uuid() {
			      var s = []
			      var hexDigits = '0123456789abcdef'
			      for (var i = 0; i < 5; i++) {
			        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
			      }
			      var uuid = s.join('')
			      let tim = parseInt(new Date().getTime() / 1000) + ''
			      this.textuuid = 'PTBD' + tim + uuid
			      console.log('PTBD' + tim + uuid)
			      return 'PTBD' + tim + uuid
			},
			//获取指定格式的时间
			getAfterDate(n,mark) {
			    var curTime = new Date()
			    var d = new Date(curTime.setMinutes(curTime.getMinutes() + n)) //n是分钟，根据自己需求定义
			    var year = d.getFullYear()
			    var mon = d.getMonth() + 1
			    var day = d.getDate()
			    var hour = d.getHours()
			    var minute = d.getMinutes()
			    var second = d.getSeconds()
			    if(mark=='normal'){
			        return year + "-" + (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day) + ' ' + (hour < 10 ? ('0' + hour) : hour) + ':' + (minute < 10 ? ('0' + minute) : minute) + ':' + (second < 10 ? ('0' + second) : second)
			    }
			     else{
			        return year + "" + (mon < 10 ? ('0' + mon) : mon) + "" + (day < 10 ? ('0' + day) : day) + '' + (hour < 10 ? ('0' + hour) : hour) + '' + (minute < 10 ? ('0' + minute) : minute) + '' + (second < 10 ? ('0' + second) : second)
			    }
			},
			// 删除
			toParse(row) {
				if (row.payStatus == '结算完成') {
					this.$refs.uTips.show({
						title: '该申请单已支付，无法进行删除操作！',
						type: 'warning',
						duration: '2300'
					})
				    return
				}
				this.showDel = true
				this.delObj = row
			},
			// 确定删除
			throughConfirmDel() {
				uni.showLoading({
					title: '加载中...'
				})
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/delBargeapply',
					method: 'post',
					data: {
						id: this.delObj.id,
						bgdId: this.delObj.bgdId
					},
					success: (res) => {
						this.getState1()
						uni.hideLoading()
						this.$refs.uTips.show({
							title: '删除成功！',
							type: 'success',
							duration: '2300'
						})
					}
				})
			},
			// 查看详细
			toMoreInfo(item) {
				this.infoId = item.id
				this.upPicShow = false
				this.insertshow = true
				this.pic1 = []
				this.pic2 = []
				if(item.shipId) { 
					uni.request({
						url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/getbargefilesdata',
						method: 'post',
						header: {
							'Content-Type': 'application/json;charset=UTF-8'
						},
						data: {
							bgBargeid: item.shipId,
							typ: '驳船'
						},
						success: (res) => {
							this.fileDate1 = JSON.parse(JSON.stringify(res.data))
							this.fileDate1.forEach(item => {
								this.pic1.push(item.url)
							})
						}
					})
				}
				
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/getbargefilesdata',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						bgBargeid: item.id,
						typ: '申请'
					},
					success: (res) => {
						this.fileDate2 = JSON.parse(JSON.stringify(res.data))
						this.fileDate2.forEach(item => {
							this.pic2.push(item.url)
						})
					}
				})
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/' + item.id,
					method: 'get',
					success: (res) => {
						this.form = res.data.data
						console.log(this.carItem)
					}
				})
				this.showInfo = true
			},
			getState1() {
				uni.showLoading({
					title: '加载中...'
				})
				let params = {
				  pageNum: 1,
				  pageSize: 100,
				  username: this.concat,
				  status: this.formData.status,
				  payStatus: this.formData.payStatus,
				  cargo: this.formData.cargo,
				  bargenam: this.formData.bargenam,
				}
				if (this.concat == 'admin管理员') delete params.username
				if (!params.status) delete params.status
				if (!params.payStatus) delete params.payStatus
				if (!params.cargo) delete params.cargo
				if (!params.bargenam) delete params.bargenam
				
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bargeapply/list',
					method: "get",
					data: params,
					success: (res) => {
						console.log(res.data)
						this.orderList = JSON.parse(JSON.stringify(res.data.rows))
						this.orderList.map(item => {
							if ( item.status == -1 ) {
								item.status = '已废除'
							} 
							else if ( item.status == 1 ) {
								item.status = '待商务部审核'
							}
							else if ( item.status == 2 ) {
								item.status = '待生产部审核'
							} else if (item.status == 3 ) {
								item.status = '已审核'
							} else if (item.status == 4) {
								item.status = '已消审'
							}
							
							if (item.payStatus == 1) {
								item.payStatus = '结算完成'
							} else {
								item.payStatus = '待结算'
							}
							
							if (this.planAB == 1) {
								if (item.ybton > 0 && item.ybton <= 1000) { 
								    item.payMoney = 5
								} else if (item.ybton > 1000 && item.ybton <= 3000) {
									item.payMoney =  10
								} else if (item.ybton > 3000 && item.ybton <= 5000) {
								    item.payMoney =  20
								} else if (item.ybton > 5000) {
								    item.payMoney =  30
								}
								} else if (this.planAB == 2) {
								if (item.ybton > 0 && item.ybton <= 3000) { 
								    item.payMoney = 10
								} else if (item.ybton > 3000) {
								    item.payMoney =  20
								} 
							}
							return item
						})
						uni.hideLoading()
					}
				})
				
			},
		},
	}
</script>

<style lang="scss">
	page {
		background-color: #F2F1F9;
	}
	.headForm {
		padding: 20rpx;
		position: fixed;
		width: 100%;
		top: 0;
		z-index: 10;
		background-color: #FFFFFF;
	
		.btnGroup {
			display: flex;
			justify-content: space-around;
			align-items: center;
			margin-top: 15rpx;
		}
	}
	.picContent {
	    display: flex;
	    flex-wrap: wrap;
	    overflow: auto;
	    // height: 400rpx;
	    justify-content: center;
	    .pic {
	      margin: 5px;
	    }
	  } 
	.font {
		margin: 5px 0;
		font-size: 16px;
	}
	::v-deep .u-form-item{
		padding: 10rpx 20rpx !important;
	}
	::v-deep .u-model__content__message {
		padding: 0 !important;
	}
	#finsihPic {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.btn {
		background-color: rgb(25, 190, 107); 
		color: #fff; 
		width: 150rpx;
		height: 55rpx;
		line-height: 55rpx;
		text-align: center;
		border-radius: 5px;
		margin-left: 10px;
	}

	.mainCon {
		.tabHead {
			margin: 0 auto;
			display: flex;
			align-items: center;
			justify-content: space-evenly;
			padding: 20rpx;
			position: fixed;
			top: 0;
			width: 100%;
			// background-color: #FFFFFF;

			.tabItem {
				width: 160rpx;
				line-height: 50rpx;
				border-radius: 25rpx;
				text-align: center;
				border: 1rpx solid #1A75FF;
				color: #868887;
				font-size: 26rpx;
			}

			.active {
				background-color: #1A75FF;
				color: #FFFFFF;
			}
		}

		.orderList {
			width: 700rpx;
			margin: 20rpx auto;
			margin-top: 100rpx;
			.orderItem {
				background-color: #FFFFFF;
				padding: 20rpx;
				border-radius: 12rpx;
				margin-bottom: 20rpx;

				.orderHead {
					.headcell {
						display: flex;
						align-items: center;
						justify-content: space-between;
						margin-bottom: 10rpx;

						.leftCon {
							display: flex;
							align-items: center;

							.labelTag {
								background-color: #E0EDFB;
								color: #4C86E7;
								width: 150rpx;
								line-height: 50rpx;
								border-radius: 25rpx;
								font-size: 26rpx;
								text-align: center;
								margin-right: 15rpx;
							}
						}

						.status1 {
							color: #4C86E7;
							font-size: 26rpx;
						}

						.dateLabel {
							color: #858585;
						}

						.status2 {
							color: #E94340;
							font-size: 30rpx;
						}
					}
				}

				.orderInfo {
					margin-top: 20rpx;
					border-top: 1rpx dashed #C1C3C2;
					padding-top: 20rpx;

					.infoCell {
						display: flex;
						align-items: center;
						margin-bottom: 10rpx;

						.labelTag {
							background-color: #E0EDFB;
							color: #4C86E7;
							width: 150rpx;
							line-height: 50rpx;
							border-radius: 25rpx;
							font-size: 26rpx;
							text-align: center;
							margin-right: 15rpx;
						}

						.labelName {
							color: #858585;
							font-size: 28rpx;
							margin-right: 50rpx;
							width: 195rpx;
						}

						.infoCon {
							color: #87888A;
						}
					}
				}

				.bottomActions {
					margin-top: 50rpx;
					display: flex;
					align-items: center;
					justify-content: center;

					.delete {
						width: 300rpx;
						line-height: 60rpx;
						text-align: center;
						border: 1rpx solid #5B92E8;
						color: #5B92E8;
						border-radius: 30rpx;
						margin: 0 30rpx;
					}

					.confirm {
						width: 300rpx;
						line-height: 60rpx;
						text-align: center;
						border: 1rpx solid #5B92E8;
						color: #5B92E8;
						border-radius: 30rpx;
						margin: 0 30rpx;
					}
				}
			}
		}
	}
</style>
